package org.jsbd.boss.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.jsbd.boss.common.DataGridModel;
import org.jsbd.boss.dao.IChannelApkConfigDAO;
import org.jsbd.boss.dao.INewExecutionGroupDAO;
import org.jsbd.boss.domian.NewExecutionGroup;
import org.jsbd.boss.domian.NewExecutionGroupMark;
import org.jsbd.boss.domian.NewExecutionGroupMarkVO;
import org.jsbd.boss.domian.channel.ChannelApkConfig;
import org.jsbd.boss.domian.channel.NewExecutionGroupMarkDto;
import org.jsbd.boss.service.INewExecutionGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("newExecutionGroupService")
public class NewExecutionGroupServiceImpl implements INewExecutionGroupService {
	
	@Resource
	private INewExecutionGroupDAO newExecutionGroupDao;
	@Autowired
	private IChannelApkConfigDAO channelApkConfigDAO;

	@Override
	public Map<String, Object> getGroupListWithPage(DataGridModel page, NewExecutionGroupMarkDto dto) {
		return newExecutionGroupDao.selectGroupListWithPage(page, dto);
	}

	@Override
	public List<NewExecutionGroupMark> getGroupDetailById(Integer groupId) {
		return newExecutionGroupDao.selectGroupDetailById(groupId);
	}

	@Override
	public void addGroup(NewExecutionGroup newExecutionGroup) {
		newExecutionGroupDao.insertGroup(newExecutionGroup);
	}

	@Override
	public NewExecutionGroup getGroupById(Integer id) {
		return newExecutionGroupDao.selectGroupById(id);
	}

	@Override
	public void updateGroup(NewExecutionGroup newExecutionGroup) {
		newExecutionGroupDao.updateGroup(newExecutionGroup);
	}

	@Override
	public List<NewExecutionGroupMark> getGroupMarkById(Integer id) {
		return newExecutionGroupDao.selectGroupMarkById(id);
	}

	@Override
	public void deleteGroup(Integer id) {
		newExecutionGroupDao.deleteGroup(id);
	}

	@Override
	public ChannelApkConfig getApkByMark(String mark) {
		ChannelApkConfig channelApkConfig = channelApkConfigDAO.getByMark(mark);
		return channelApkConfig;
	}

	@Override
	public void addGroupMark(NewExecutionGroupMark newExecutionGroupMark) {
		newExecutionGroupDao.insertGroupMark(newExecutionGroupMark);
	}

	@Override
	public void deleteGroupMark(Integer id) {
		newExecutionGroupDao.deleteGroupMark(id);
	}

	@Override
	public List<NewExecutionGroupMarkVO> getSearchDataByGroupId(NewExecutionGroupMarkDto negmDto) {
		return newExecutionGroupDao.selectSearchDataByGroupId(negmDto);
	}

	@Override
	public List<NewExecutionGroupMarkVO> getSearchDataTotalByGroupId(NewExecutionGroupMarkDto negmDto) {
		return newExecutionGroupDao.selectSearchDataTotalByGroupId(negmDto);
	}

	@Override
	public NewExecutionGroupMark getMarkByGroupIdAndMark(Integer id, String mark) {
		return newExecutionGroupDao.selectMarkByGroupIdAndMark(id, mark);
	}

	@Override
	public NewExecutionGroup getGroupByName(String groupName) {
		return newExecutionGroupDao.selectGroupByName(groupName);
	}

}
